#pragma once

#include "SimpleHistogram.h"

class DepthTracker
{
public:
	SimpleHistogram hist;
	CvRect rect;
	CvMat *subMat;
	static const int offset = 6;
	static const int upperOffset = 200;
	static const int lowerOffset = 200;
	static const int atLeastPixel = 50;
	CvPoint3D32f center;
	CvPoint2D32f depthRange;
	int lb, ub;
	CvMat *inRangeMat;

	int *tmpBins;


public:
	DepthTracker(void);
	~DepthTracker(void);
	void showHist(CvMat *mat, CvRect subRect);
	void initTracking(CvMat *mat, CvRect rect, double *depthVal=NULL);
	double calcDis(const SimpleHistogram &a, const SimpleHistogram& b);
	CvRect tracking(CvMat *mat, double *depthVal = NULL);
	void applyDepthRange(CvMat *mat);
};

